import request from '@/utils/request'


// 分页查询所有采购单
export function listunreceivepurchase(params) {
  return request({
    url: '/ware/purchase/unreceive/list',
    method: 'GET',
    params: params
  })
}

// 分页查询所有采购单
export function listpurchase(params) {
  return request({
    url: '/ware/purchase/list',
    method: 'GET',
    params: params
  })
}

// 新增或修改采购单信息
export function addOrUpdatepurchase(data) {
  if (!data.id){
    return request({
      url: '/ware/purchase/save',
      method: 'POST',
      data: data
    })
  }else {
    return request({
      url: '/ware/purchase/update',
      method: 'POST',
      data: data
    })
  }
}


// 合并整单
export function mergepurchase(data) {
  return request({
    url: '/ware/purchase/merge',
    method: 'POST',
    data: data
  })
}

// 修改采购单信息
export function updatepurchase(data) {
  return request({
    url: '/ware/purchase/update',
    method: 'POST',
    data: data
  })
}

// 新增采购单信息
export function addpurchase(data) {
  return request({
    url: '/ware/purchase/save',
    method: 'POST',
    data: data
  })
}

// 批量修改采购单信息
export function updatepurchaseBatch(data) {
  return request({
    url: '/ware/purchase/update/sort',
    method: 'POST',
    data: data
  })
}


// 查询采购单信息
export function getpurchaseById(id) {
  return request({
    url: '/ware/purchase/info/'+id,
    method: 'GET'
  })
}


// 批量删除采购单信息
export function delpurchaseByIds(ids) {
  return request({
    url: '/ware/purchase/delete',
    method: 'delete',
    data: ids
  })
}
